package com.vlin.device.value.converter;

import java.util.List;

public abstract class AbstractConditionAndConverter  implements ConditionAndConverter {



	@Override
	public Object handleAndConvert(String value, Condition condition) {

		List<ConditionHandler> listConditionHandler = getConditionHandler();

		if (listConditionHandler != null) {
			for (ConditionHandler conditionHandler : listConditionHandler) {
				if (conditionHandler.supportCondition(condition)) {
					Object result = null;
					if (conditionHandler.isOutOfRange(value, condition)) {
						result = conditionHandler.getResult(value, condition);
					}
					return result;
				}
			}
		}

		return null;
	}


}
